import re


class Welding:
    def __init__(self, sel, inse):
        self.sel = sel
        self.inse = inse
        # "熔接", "台班", "用车", "用工"

    def select(self):
        if self.sel in ("熔接"):
            if self.theUnit() <= 96:
                return 156
            elif self.theUnit() > 96:
                return 157
        elif self.sel in ("用车", "用工"):
            return 159

    def theUnit(self):
        try:
            xx = re.findall("\d*芯$|\d*D$", self.inse)[0]
            yy = int(re.split("芯|D", xx)[0])
            return yy
        except:
            return

    def getWelding(self):
        return self.select()
